﻿using System;
using System.Collections.Generic;
using IllusionUtility.GetUtility;
using Manager;
using UnityEngine;

namespace SceneAssist
{
	// Token: 0x0200051A RID: 1306
	public class ItemHolder : MonoBehaviour
	{
		// Token: 0x17000345 RID: 837
		// (get) Token: 0x06001F2B RID: 7979 RVA: 0x00122730 File Offset: 0x00120930
		// (set) Token: 0x06001F2C RID: 7980 RVA: 0x00122738 File Offset: 0x00120938
		public global::CharFemale CharFemale { get; private set; }

		// Token: 0x17000346 RID: 838
		// (get) Token: 0x06001F2D RID: 7981 RVA: 0x00122744 File Offset: 0x00120944
		public AnimatorStateInfo NowState
		{
			get
			{
				return this.CharFemale.getAnimatorStateInfo(0);
			}
		}

		// Token: 0x06001F2E RID: 7982 RVA: 0x00122754 File Offset: 0x00120954
		public virtual void PlayAnime(string _name, int _layer = 0)
		{
			int key = (!this.CharFemale.femaleCustomInfo.isConcierge) ? this.CharFemale.femaleCustomInfo.personality : 108;
			
			this.CharFemale.setPlay(_name, _layer);
		}

		// Token: 0x06001F2F RID: 7983 RVA: 0x00122810 File Offset: 0x00120A10
		public virtual bool LoadItem(string _asset, string _file, string _parent)
		{
			global::AssetBundleLoadAssetOperation assetBundleLoadAssetOperation = global::KK_Lib.LoadFile<GameObject>(_asset, _file, string.Empty);
			if (assetBundleLoadAssetOperation == null)
			{
				return false;
			}
			GameObject gameObject = assetBundleLoadAssetOperation.GetAsset<GameObject>();
			if (null == gameObject)
			{
				global::Debug.LogError("そんなのねーです");
				return false;
			}
			gameObject = UnityEngine.Object.Instantiate<GameObject>(gameObject);
			global::AssetBundleManager.UnloadAssetBundle(_asset, true, null);
			GameObject gameObject2 = this.CharFemale.femaleBody.objBone.transform.FindLoop(_parent);
			if (gameObject2)
			{
				gameObject.transform.SetParent(gameObject2.transform, false);
			}
			else
			{
				gameObject.transform.SetParent(this.CharFemale.transform);
			}
			this.listItem.Add(gameObject);
			return true;
		}

		// Token: 0x06001F30 RID: 7984 RVA: 0x001228C4 File Offset: 0x00120AC4
		public virtual void ReleaseItem(string _name)
		{
			int num = this.listItem.FindIndex((GameObject o) => o.name == _name);
			if (num < 0)
			{
				return;
			}
			GameObject obj = this.listItem[num];
			UnityEngine.Object.Destroy(obj);
			this.listItem.RemoveAt(num);
		}

		// Token: 0x06001F31 RID: 7985 RVA: 0x00122920 File Offset: 0x00120B20
		public virtual void ReleaseAllItem()
		{
			if (this.listItem == null)
			{
				return;
			}
			for (int i = 0; i < this.listItem.Count; i++)
			{
				if (this.listItem[i] != null)
				{
					UnityEngine.Object.Destroy(this.listItem[i]);
				}
			}
			this.listItem.Clear();
		}

		// Token: 0x06001F32 RID: 7986 RVA: 0x00122988 File Offset: 0x00120B88
		public virtual void SetVisible(bool _visible)
		{
			for (int i = 0; i < this.listItem.Count; i++)
			{
				if (!(this.listItem[i] == null))
				{
					if (this.listItem[i].activeSelf != _visible)
					{
						this.listItem[i].SetActive(_visible);
					}
				}
			}
		}

		// Token: 0x06001F33 RID: 7987 RVA: 0x001229F8 File Offset: 0x00120BF8
		public virtual void Awake()
		{
			this.CharFemale = base.GetComponent<global::CharFemale>();
		}

		// Token: 0x06001F34 RID: 7988 RVA: 0x00122A08 File Offset: 0x00120C08
		public virtual void OnDestroy()
		{
			this.ReleaseAllItem();
		}

		// Token: 0x040027AE RID: 10158
		public List<GameObject> listItem = new List<GameObject>();
	}
}
